<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<%
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ request.getContextPath() + "/";
%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<base href="<%=basePath%>">
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="renderer" content="webkit">
<title>用户列表</title>

<link rel="stylesheet" href="css/reset.css">
<link rel="stylesheet" href="css/user-list.css">

</head>
<body>
	<div class="user-list">


		<c:choose>
			<c:when test="${!empty userlist}">
				<form id="form-1" name="userListForm" action="DeleteAllUser"
					method="post">
					<table>
						<caption>用户信息列表</caption>
						<tr>
							<th>选择</th>
							<th>ID</th>
							<th>姓名</th>
							<th>用户名</th>
							<th>用户类型</th>
							<th>性别</th>
							<th>部门</th>
							<th>操作</th>







						</tr>
						<c:forEach items="${userlist}" var="user" varStatus="st">
							<!--通过varStatus的属性（index count first last）count(当前记录号)%2 判断是否是偶数行  -->

							<!-- 设置偶数行的背景颜色为 类class bg1 -->
							<tr class="${st.count%2==0?"tr-1":"tr-2"}">
								<td><input type="checkbox" name="delID" value="${user.id}"></td>
								<td>${user.id}</td>
								<td>${user.name}</td>
								<td>${user.userName}</td>
								<td>${user.type==1?"员工":"管理员"}</td>
								<td>${user.sex==1?"男":"女"}</td>
								<td>${user.branch==1?"人事部":""||user.branch==2?"财务部":""||user.branch==3?"研发部":""||user.branch==4?"市场部":""||user.branch==5?"销售部":""}</td>


								<td><a href="FindUser?id=${user.id}">查看</a> | <a
									href="UpdateUser?id=${user.id}">修改</a> | <a
									href="DeleteUser?id=${user.id}"
									onclick="javascirpt:return delConfirm();">删除</a></td>

							</tr>


						</c:forEach>
					</table>
					<div class="bottom">
						<!--分页数据放在pageBean中，通过EL表达式语言输出其当前的值-->

						<input class="button-1" id="select-all" type="button" value="全选">

						<input class="button-2" type="submit" value="批量删除">

						共有${pageBean.recordCnt}条记录 共${pageBean.pageCnt}页
						当前是第${pageBean.curPage}页 转到第 <select id="page-sel">
							<c:forEach begin="1" end="${pageBean.pageCnt}" step="1"
								var="pageNum">
								<option ${pageBean.curPage==pageNum?"selected=\"selected\"":""}
									value="${pageNum}">${pageNum}</option>
							</c:forEach>
						</select> 页 <input class="button-3" id="goto-page" type="button" value="GO">

						<input class="button-1" id="goto-page" type="button"
							onclick="javaScript:toPage('1')" value="首页"> <input
							class="button-1" id="goto-page" type="button"
							onclick="javaScript:toPage('${pageBean.prePage}')" value="上页">
						<input class="button-1" id="goto-page" type="button"
							onclick="javaScript:toPage('${pageBean.nextPage}')" value="下页">
						<input class="button-1" id="goto-page" type="button"
							onclick="javaScript:toPage('${pageBean.pageCnt}')" value="尾页">

					</div>
				</form>
			</c:when>
			<c:otherwise>
				<p class="err-info">没有用户</p>
			</c:otherwise>
		</c:choose>
	</div>

	<script type="text/javascript" src="js/jquery-3.2.1.min.js"></script>
	<script type="text/javascript" src="js/user-list.js"></script>

</body>

</html>